import Vue from 'vue'

import 'normalize.css/normalize.css'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en'

import '@/styles/index.scss'
import i18n from '@/lang/index.js'
import App from './App'
import store from './store'
import router from './router'
// import PageTools from '@/components/PageTools/index.vue'
import globalComponents from '@/components/index.js'
import '@/icons'
import '@/permission'
// Vue.component('PageTools', PageTools)
/* if (process.env.NODE_ENV === 'production') {
  const { mockXHR } = require('../mock')
  mockXHR()
} */
Vue.use(globalComponents)
Vue.use(ElementUI, { locale })

Vue.config.productionTip = false
Vue.directive('allow', {
  inserted: function(el, binding) {
    const point = store.state.user.userInfo.roles.points
    if (point.includes(binding.value)) {
    } else {
      el.parentNode.removeChild(el)
    }
  }
})
new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
